#pragma once

#include <iostream>
#include <unistd.h>
#include <pthread.h>

namespace Local_Cond
{
    class LocalCond
    {
    public:
        LocalCond()
        {
            pthread_cond_init(&_cond, nullptr);
        }
        ~LocalCond()
        {
            pthread_cond_destroy(&_cond);
        }

        void Wait(pthread_mutex_t *mutex)
        {
            pthread_cond_wait(&_cond, mutex);
        }

        void Signal()
        {
            pthread_cond_signal(&_cond);
        }

        void Broadcast()
        {
            pthread_cond_broadcast(&_cond);
        }

    private:
        pthread_cond_t _cond;
    };
}
